/**
 * 
 */
(function(Tracker){

var Tracker = Tracker || {

Info : {
	screen : function() {
		var r = "";
		if (screen) r = screen.width+"x"+screen.height;
		return r;
	},
	referrer : function() {
		var r = "";
		if (document.referrer) r = document.referrer;
		return r;
	},
	agent : function() {
		var r = "";
		if (navigator.userAgent) r = navigator.userAgent;
		return r;
	},
	jvm_enabled : function() {
		var r = "";
		if (navigator.javaEnabled()) r = 1;
		else r= 0;
		return r;
	},
	flash_ver : function() {
		var f="",n=navigator;

		if (n.plugins && n.plugins.length) {
			for (var ii=0;ii<n.plugins.length;ii++) {
				if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {
					f=n.plugins[ii].description.split('Shockwave Flash ')[1];
					break;
				}
			}
		}
		else
		if (window.ActiveXObject) {
			for (var ii=10;ii>=2;ii--) {
				try {
					var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
					if (fl) {
						f=ii + '.0';
						break;
					}
				}
				 catch(e) {}
			}
		}
		return f;
	},
	appName : function() {
		var r = "";
		if (navigator.appName) r = navigator.appName;
		return r;
	}
},

Util : {
	cookie : function(name, value, options) {
		if(typeof value != 'undefined') {
			//设置cookie
			options = options || {};
			if (value === null) {
	            value = '';
	            options.expires = -1;
	        }
			var expires = '';
	        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
	            var date;
	            if (typeof options.expires == 'number') {
	                date = new Date();
	                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
	            } else {
	                date = options.expires;
	            }
	            expires = '; expires=' + date.toUTCString();
	        }
	        var path = options.path ? '; path=' + options.path : '';
	        var domain = options.domain ? '; domain=' + options.domain : '';
	        var secure = options.secure ? '; secure' : '';
	        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
		} else {
			//获取cookie值
			var cookieValue = null;
	        if (document.cookie && document.cookie != '') {
	            var cookies = document.cookie.split(';');
	            for (var i = 0; i < cookies.length; i++) {
	                var cookie = cookies[i].replace(/(^\s*)|(\s*$)/g, "");
	                // Does this cookie string begin with the name we want?
	                if (cookie.substring(0, name.length + 1) == (name + '=')) {
	                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
	                    break;
	                }
	            }
	        }
	        return cookieValue;
		}
	},
	param : function(params) {
		var _ele = new Array();
		for(var ele in params) _ele.push(ele+'='+encodeURIComponent(params[ele]));
		return _ele.join('&');
	},
	url : function(url) {
		
	}
}

};
var Info = Tracker.Info;
var params = {
	a: Info.screen(),
	b: Info.agent(),
	c: Info.jvm_enabled(),
	d: Info.referrer(),
	_: Math.random()
};
var _params = Tracker.Util.param(params);
var src = 'http://www.localhost.com/stat.gif?'+_params;
document.write('<img src="'+src+'" title="stat" />');
})();
